<template>
    <section class="content-box">
        <div>
        <!--工具条-->
        <el-col class="toolbar">
            <el-col :span="12">
                <h2>辅助核算项目</h2>
            </el-col>
            <el-col :span="12">
                <el-form :inline="true" :model="filters">
                    <el-form-item>
                        <el-input v-model="filters.name" placeholder="请输入查询项"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" class="el-icon-search" v-on:click="handleFilterd"> 查询</el-button>
                    </el-form-item>
                </el-form>
            </el-col>
        </el-col>
        <!--列表-->
        <el-table class="indexList" :data="tableData"  highlight-current-row>
            <el-table-column prop="AI_Code" label="编码" sortable width="150">
            </el-table-column>
            <el-table-column prop="AI_Name" label="名称" sortable  show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="AI_AssistItemType" label="类型" sortable>
            </el-table-column>
            <el-table-column prop="AI_CreateBy" label="创建人" sortable>
            </el-table-column>
            <el-table-column prop="AI_CreateDate" label="创建日期" sortable>
            </el-table-column>
        </el-table>
        <!--工具条-->
       <!--  <el-col :span="24" class="toolbar">
            <el-pagination @current-change="changePage" layout="prev, pager, next" :page-size="rows" :current-page="currentPage" :total="total" style="float:right;">
            </el-pagination>
        </el-col> -->
        </div>
    </section>
</template>

<script>
import axios from '../../util/axios';
export default {
    name: 'AssistingAccountProject',
    data() {
        return {
            tableData: [],//数据列表
            total: 0, //数据总数
            rows: 10, //每页显示多少条
            currentPage: 1,//当前页数
            filters: { //查询项
                name: '',
            }
        }
    },
    methods:{
        changePage(page) {//当前页数
            this.currentPage = page;
            this.getList();
        },
        getList:function() {      
            axios.post("getAssistingAccountProjectList",{
                page: this.currentPage,  // 当前页数， 
                rows: this.rows, // 每页多少条
            }).then(data => {
                this.total = data.total;//总页数
                this.tableData = data.rows; 
            }).catch(err => {
                console.log(err);
            })
        },
        /**
         * 查询项
         */
        handleFilterd() {
            var filterName = {"groupOp":"OR","rules":[{"field":"AI_Code","op":"cn","data":this.filters.name},{"field":"AI_Name","op":"cn","data":this.filters.name}],"groups":[]};
            axios.post("getAssistingAccountProjectList",{filter:JSON.stringify(filterName)}).then(data => {
                this.tableData = data.rows;
            }).catch(err => {
                console.log(err);
            })
        }
    },
    mounted(){
        this.getList();
    }
}
</script>

<style scoped lang="scss">
@import '../../common/css/index.css';
</style>
